package com.maimao.model.order;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import lombok.*;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * @author MaoLin Wang
 * @date 2021/1/15 6:06 下午
 */
@Setter
@Getter
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
@TableName("mm_order_goods")
@JsonInclude(JsonInclude.Include.NON_NULL)
public class OrderGoods implements Serializable {


    private static final long serialVersionUID = 3569250487711874176L;
    /**
     * 订单商品详情id
     */
    @TableId(type = IdType.AUTO)
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long id;
    /**
     * 订单id
     */
    @TableField("order_id")
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long orderId;

    /**
     * 订单-店铺 id
     */
    @TableField("order_shop_id")
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long orderShopId;

    @TableField("comment")
    private Boolean comment;

    @TableField("sku_id")
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long skuId;

    @TableField("goods_id")
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long goodsId;
    /**
     * 商品标题
     */
    private String title;

    private Integer num;

    private BigDecimal price;

    @TableField("brand_id")
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long brandId;

    /**
     * sku规格 json格式
     */
    private String spec;

    @TableField("spec_display_name")
    private String specDisplayName;

    /**
     * 发货状态 1 已发货 0未发货 2 已换货 3已退货
     */
    @TableField("shipped_status")
    private Integer shippedStatus;

    @TableField("receive")
    private Boolean receive;

    /**
     * 确认收货时间
     */
    @TableField("receive_time")
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    private LocalDateTime receiveTime;

    private String picture;

    /**
     * 赠送积分数
     */
    private Integer integral;


    @Override
    public String toString() {
        return "OrderGoods{" +
                "id=" + id +
                ", orderId=" + orderId +
                ", orderShopId=" + orderShopId +
                ", comment=" + comment +
                ", skuId=" + skuId +
                ", goodsId=" + goodsId +
                ", title='" + title + '\'' +
                ", num=" + num +
                ", price=" + price +
                ", brandId=" + brandId +
                ", spec='" + spec + '\'' +
                ", specDisplayName='" + specDisplayName + '\'' +
                ", shippedStatus=" + shippedStatus +
                ", receive=" + receive +
                ", receiveTime=" + receiveTime +
                ", picture='" + picture + '\'' +
                ", integral=" + integral +
                '}';
    }
}
